#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>

int main(int argc, char**argv)
{
    char buf[128] = {0};
    getcwd(buf, 128);
    printf("buf = %s\n", buf);
    int fd1 = open(argv[1], O_RDWR|O_CREAT, 0777);//1.txt
    if(fd1 == -1)
    {
        perror("open fd1 error:");
        return -1;
    }

    perror("");
    chdir("/home/china");
    perror("");
    bzero(buf, 128);
    getcwd(buf, 128);
    printf("buf = %s\n", buf);

    int fd2 = open(argv[2], O_RDWR|O_CREAT, 0777);//2.txt
    if(fd2 == -1)
    {
        perror("open fd2 error:");
        return -1;
    }

    close(fd1);
    close(fd2);

    //while(1);
}
